<template>
  <k-form-modal v-model="modalState.visible" drawer width="middle" title="操作记录" @submit="hide">
    <KTable v-if="modalState.visible" v-loading="state.loading" v-bind="tableState" v-on="tableEvent">
    </KTable>
  </k-form-modal>
</template>

<script setup lang='ts'>
import { useFormModal } from '@crud/index';
import { useTableList } from '../hooks/use-operation-table';
defineOptions({
  name: 'OperationListModal'
});
const { state, tableState, tableEvent, ...methods } = useTableList();
const { state: modalState, show, hide } = useFormModal({
  onShow: (mode = 0, data: any) => {
    tableState.value.data = [];
    if (data) {
      state.params = {
        colonelId: data.colonel_id
      };
      methods.getList();
    }
  }
});
defineExpose({
  show
});
</script>
